<?php

App::uses('AppModel', 'Model');

/**
 * Profile Model
 *
 */
class Profile extends AppModel {

    /**
     * virtualFields
     * 
     * @var array
     */
    public $virtualFields = array(
        'fullname' => 'CONCAT(Profile.first_name, " ", Profile.last_name)',
    );

    /**
     * Validation rules
     *
     * @var array
     */
    public $validate = array(
        'phone' => array(
            'phone' => array(
                'rule' => array('phone'),
            //'message' => 'Your custom message here',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'modified' => array(
            'datetime' => array(
                'rule' => array('datetime'),
            //'message' => 'Your custom message here',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
        'is_published' => array(
            'boolean' => array(
                'rule' => array('boolean'),
            //'message' => 'Your custom message here',
            //'allowEmpty' => false,
            //'required' => false,
            //'last' => false, // Stop validation after this rule
            //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ),
        ),
    );

    /**
     * hasOne
     * 
     * @var array
     */
    public $hasOne = array(
        'User' => array(
            'className' => 'User',
            'foreignKey' => 'id',
            'dependent' => true
        )
    );

}
